#include "mainwindow.h"

MainWindow::MainWindow()
{
    m_playlist = new Playlist(this);
    m_widget = new QWidget(this);
    setCentralWidget(m_widget);
    m_layout = new QVBoxLayout(m_widget);
    m_widget->setLayout(m_layout);

    m_controller = new PlayerController(m_widget);
    m_layout->addWidget(m_controller);

    m_innerWidget = new QWidget(m_widget);
    m_layout->addWidget(m_innerWidget);
    m_innerLayout = new QHBoxLayout(m_innerWidget);
    m_innerWidget->setLayout(m_innerLayout);

    connect(m_controller->prev(), SIGNAL(clicked()), m_playlist, SLOT(prev()));
    connect(m_controller->play(), SIGNAL(clicked()), m_playlist, SLOT(play()));
    connect(m_controller->pause(), SIGNAL(clicked()), m_playlist, SLOT(pause()));
    connect(m_controller->stop(), SIGNAL(clicked()), m_playlist, SLOT(stop()));
    connect(m_controller->next(), SIGNAL(clicked()), m_playlist, SLOT(next()));

    m_splitter = new QSplitter(m_innerWidget);
    m_innerLayout->addWidget(m_splitter);

    m_metaDataDisplay = new MetaDataDisplay(this);
    m_splitter->addWidget(m_metaDataDisplay);
    connect(m_playlist, SIGNAL(playing(SongData*, int)), m_metaDataDisplay, SLOT(display(SongData*)));

    m_tracklist = new TrackList(this);
    m_splitter->addWidget(m_tracklist);
    connect(m_playlist, SIGNAL(added(Song*, int)), m_tracklist, SLOT(slotAdded(Song*,int)));
    connect(m_playlist, SIGNAL(playing(int)), m_tracklist, SLOT(slotPlaying(int)));

}

MainWindow::~MainWindow()
{

}

